package org.credo.io;

import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;

/**
 * String作为物理节点关联
 */
public class StringNodeTest {

	public static void main(String[] args) throws IOException {
		System.out.println("==========StringReader==========");
		String tester="英文：Binary files 包含在 ASCII及扩展 ASCII 字符中编写的数据或程序指令的文件。";
		
		char[] buffer=new char[320];
		int hasRead=0;
		StringReader sr=new StringReader(tester);
		while((hasRead=sr.read(buffer)) >0){
			System.out.println(new String(buffer,0,hasRead));
		}
		System.out.println("==========StringWriter==========");
		
		StringWriter sw=new StringWriter();
		sw.write("床前明月光!");
		sw.write(buffer);
		System.out.println(sw.toString());
	}

}
